package com.dx.wx.service.impl;

import com.dx.wx.service.DxHomeService;
import com.dx.wx.util.DxUtil;
import com.ejlchina.data.Array;
import com.ejlchina.data.Mapper;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

@Service
public class DxHomeServiceImpl implements DxHomeService {

    @Override
    public Array bannerList(String appId) {
        Map filter = new HashMap<>();
        filter.put("field_name","status__c");
        filter.put("field_values","option1");
        filter.put("operator","EQ");
        Map appIdFilter = DxUtil.addAppIdFilter(appId);
        Map data = DxUtil.createSearchData(filter,appIdFilter);
        data.put("dataObjectApiName","banner__c");
        return DxUtil.findSimple(data);
    }

    @Override
    public Mapper gift() {
        Map filter = new HashMap<>();
        filter.put("field_name","life_status");
        filter.put("field_values","normal");
        filter.put("operator","EQ");
        Map data  = DxUtil.createSearchData(filter);
        data.put("dataObjectApiName","gift__c");
        return DxUtil.findOne(data);
    }
}
